#include <stdio.h>
#include <stdlib.h>

int NOD(int a, int b)
{
 while (a && b)
        if (a >= b)
           a %= b;
        else
           b %= a;
    return a | b;
}

void main(void)
{
	int a, b, c, check;
	printf("Greatest Common Divisor [a,b]\nEnter a b (through gap) :");
	check=scanf("%d %d", &a, &b);
	
	if (check != 2)
	{
		printf("Incorrect input. Goodbye!\n");
		return;
	}

	c=NOD(a, b);

	printf("\nGCD [%d,%d] = %d\n", a, b, c);

	system("PAUSE");
}